import java.util.LinkedHashSet;
import java.util.Set;

import aima.core.agent.Action;
import aima.core.search.framework.ActionsFunction;

public class PacmanActionsFunction implements ActionsFunction {

	@Override
	public Set<Action> actions(Object state) {
		final PacmanMap map = (PacmanMap) state;
		final Set<Action> actions = new LinkedHashSet<Action>();
		for (final Direction direction : Direction.values()) {
			final Point future = direction.translate(map.getPacmanLocation());
			if (map.isTraversable(future)) {
				actions.add(new PacmanAction(direction));
			}
		}
		return actions;

	}

}
